#include "processPool.h"

void clientlog(char *msg){

    struct tm *p;

    //char buf[100]={0};
    char timebuf[32]={0};
    char logbuf[200]={0};
   // memset(buf,0,sizeof(buf));

    time_t t=time(NULL);
    p=localtime(&t);

    snprintf(timebuf,32,
             "%04d-%02d-%02d %02d:%02d:%02d",
             p->tm_year+1900,p->tm_mon+1,p->tm_mday,
             p->tm_hour,p->tm_min,p->tm_sec);

    snprintf(logbuf,sizeof(logbuf),"[%s] client command: %s",
             timebuf,msg);

    FILE *fp=fopen("clientlog.txt","a+");
    fprintf(fp,"%s\n",logbuf);

    //send(clientfd,logbuf,sizeof(logbuf),0);

    fclose(fp);
}
